package com.biancheng.biancheng.biancheng2;

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class 员工排序_调薪_职级高的排在前面 {
//        6
//        张三 3 3 3000
//        李四 3 4 3000
//        王五 3 3 4000
//        赵六 4 3 3000
//        陆奇 4 4 4000
//        闫八 4 4 3980
//
//        输出：
//
//        赵六 4 3 3000.00
//        闫八 4 4 3980.99
//        陆奇 4 4 4000.00
//        李四 3 4 3000.00
//        张三 3 3 3000.00
//        王五 3 3 4000.00
//        java编程，排序对象，三个步骤，创建arraylist，创建比较器，arraylist调用sort方法传入比较器
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        List<Employee> el = new ArrayList<>();
        int n = scanner.nextInt();
        for (int i = 0; i < n; i++) {//接收n个员工并保存到AL
            Employee e = new Employee();
            e.setName(scanner.next());
            e.setLevel(scanner.nextInt());
            e.setWorkTime(scanner.nextInt());
            e.setSalary(scanner.nextInt());
            el.add(e);
        }
        Order(el);//开始排序
    }

    private static void Order(List<Employee> el) {
        Comparator<Employee> lc = Comparator.comparing(Employee::getLevel).reversed();
        Comparator<Employee> wc = Comparator.comparing(Employee::getWorkTime).reversed();
        Comparator<Employee> sc = Comparator.comparing(Employee::getSalary).reversed();
        el.sort(lc.thenComparing(sc).thenComparing(wc));
        for (Employee e : el) {
            System.out.println(e);
        }
    }
}

class Employee {
    private String name;
    private Integer level;
    private Integer workTime;
    private Integer salary;

    public Employee(String name, Integer level, Integer workTime, Integer salary) {
        this.name = name;
        this.level = level;
        this.workTime = workTime;
        this.salary = salary;
    }

    public Employee() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public Integer getWorkTime() {
        return workTime;
    }

    public void setWorkTime(Integer workTime) {
        this.workTime = workTime;
    }

    public Integer getSalary() {
        return salary;
    }

    public void setSalary(Integer salary) {
        this.salary = salary;
    }

    @Override
    public String toString() {
        return name + " " + level + " " + workTime + " " + salary;
    }

}
